# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=qtpy
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.9.0
pkgrel=2
pkgdesc='Provides an uniform layer to support PyQt5, PyQt4 and PySide with a single codebase (mingw-w64)'
arch=('any')
url="https://github.com/spyder-ide/qtpy/"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-pyqt5: Qt5 Python bindings"
"${MINGW_PACKAGE_PREFIX}-pyside2-qt5: PySide Qt5 Python bindings")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("$_realname-${pkgver}.tar.gz::https://github.com/spyder-ide/${_realname}/archive/v${pkgver}.tar.gz")
sha256sums=('a6783acab8f7f7b04026c7da19c65bf904d69629d06d951cb7b9344468270c5b')

prepare() {  
  cd "$srcdir"
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"  
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt"
}
